package com.example.demo.controller;

import com.example.demo.pojo.RestResponse;
import com.example.demo.pojo.zuwang.zuwang.ZuWangFromJSRes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/systemInfo")
@CrossOrigin
public class SystemInfoController {


    @Value("${dataLoc.dataState.jicheng}")
    public String dateState_jicheng_loc;
    @Value("${dataLoc.dataState.jieshou}")
    public String dateState_jieshou_loc;
    @Value("${dataLoc.dataState.remote}")
    public String dateState_remote_loc;

    @Autowired
    ConfigFileUtil configFileUtil;

    @PostMapping("/readJichengInfo")
    public RestResponse readJichengInfo() throws Exception {

        ZuWangFromJSRes zw = configFileUtil.readDataMonitor(dateState_jicheng_loc);
        return RestResponse.success(zw);
    }

    @PostMapping("/readJieshouInfo")
    public RestResponse readJieshouInfo() throws Exception {

        ZuWangFromJSRes zw = configFileUtil.readDataMonitor(dateState_jieshou_loc);
        return RestResponse.success(zw);
    }

    @PostMapping("/readRemoteInfo")
    public RestResponse readRemoteInfo() throws Exception {

        ZuWangFromJSRes zw = configFileUtil.readDataMonitor(dateState_remote_loc);
        return RestResponse.success(zw);
    }
}
